package com.scnu.edu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.scnu.edu.entity.PlayRecord;
import com.scnu.edu.mapper.PlayRecordMapper;
import com.scnu.edu.service.PlayRecordService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlayRecordServiceImpl extends ServiceImpl<PlayRecordMapper, PlayRecord> implements PlayRecordService {
    @Override
    public List<PlayRecord> getPlayRecordsByMovieId(Long movieId) {
        LambdaQueryWrapper<PlayRecord> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(PlayRecord::getMovieId, movieId)
                .orderByDesc(PlayRecord::getCreateTime);
        return this.list(wrapper);
    }
}